package com.yyt.module_main.act;

import android.graphics.Color;
import android.os.Bundle;
import android.text.TextUtils;
import android.widget.TextView;

import com.alibaba.android.arouter.facade.annotation.Route;
import com.bumptech.glide.Glide;
import com.bumptech.glide.load.engine.DiskCacheStrategy;
import com.yyt.libsrc.helper.LocalHelper;
import com.yyt.libsrc.router.RouteTable;
import com.yyt.module_main.R;
import com.yyt.module_main.databinding.ActivityLoginBinding;
import com.yyt.module_main.vm.LoginVM;

import top.lixb.libcommon.base.BaseActivity;
import top.lixb.libcommon.base.RefreshableActivity;
import top.lixb.libcommon.glide.GlideOptions;


@Route(path = RouteTable.main_login)
public class LoginActivity extends BaseActivity<ActivityLoginBinding> {

    private LoginVM mVm;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_login);
        mVm = new LoginVM();
        mContentBinding.setVm(mVm);
        mVm.setActivity(this);
        setNoTitle();
        if (null != getIntent() && getIntent().getExtras() != null) {
            mVm.mobile.set(getIntent().getStringExtra("mobile"));
            mVm.pwd.set(getIntent().getStringExtra("pwd"));
        }

        String headIconUrl = LocalHelper.getHeadIconUrl();

        GlideOptions requestOptions = new GlideOptions();
        requestOptions.placeholder(R.mipmap.icon_login).diskCacheStrategy(DiskCacheStrategy.RESOURCE);
        Glide.with(this).applyDefaultRequestOptions(requestOptions).load(headIconUrl).into(mContentBinding.civHead);
        mVm.uname.set(LocalHelper.getUserName());

    }


}
